package net.csdn.business.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;


/**
 * @Desc: 操作日志动作枚举
 * @ClassName: ActionTypeEnum
 * @Author: zhangyl
 * @Date: 2022/8/3 10:36
 */
@Getter
public enum ActionTypeEnum implements IEnum<Integer> {
    BANNER_ADD(1, "添加banner"),
    BANNER_UPDATE(2, "更新banner"),
    BANNER_DELETE(3, "删除banner"),
    BANNER_ENABLE(4, "修改banner状态"),
    BANNER_MOVE(5, "移动banner"),
    REC_ORG_ADD(6, "添加推荐组织"),
    REC_ORG_UPDATE(7, "更新推荐组织"),
    REC_ORG_DELETE(8, "删除推荐组织"),
    REC_ORG_ENABLE(9, "修改推荐组织状态"),
    REC_ORG_MOVE(10, "移动推荐组织"),
    REC_PROJECT_ADD(11, "添加推荐项目"),
    REC_PROJECT_UPDATE(12, "更新推荐项目"),
    REC_PROJECT_DELETE(13, "删除推荐项目"),
    REC_PROJECT_ENABLE(14, "修改推荐项目状态"),
    REC_PROJECT_MOVE(15, "移动推荐项目"),
    TOOLBAR_ADD(81, "添加toolbar"),
    TOOLBAR_UPDATE(82, "更新toolbar"),
    TOOLBAR_DELETE(83, "删除toolbar"),
    TOOLBAR_ENABLE(84, "修改toolbar状态"),
    TOOLBAR_MOVE(85, "移动toolbar"),


    // 用户相关
    // USER_REGISTER(16, "用户注册"),
    // USER_LOGOFF(17, "用户注销"),

    USER_DEL(18, "删除用户"),
    USER_LOCK(19, "锁定用户"),
    USER_UNLOCK(20, "解锁用户"),
    USER_UPDATE(21, "修改用户基本信息"),
    USER_PWD_RESET(22, "重置用户密码"),
    USER_QUOTA_UPDATE(23, "修改权限设置"),
    USER_KICK(24, "强制用户下线"),
    USER_SIMULATE(25, "模拟用户"),
    USER_SIMULATE_CANCEL(26, "取消模拟用户"),

    // 白名单相关
    WHITE_NAMESPACE_ADD(27, "添加Namespace白名单"),
    WHITE_NAMESPACE_UPDATE(28, "修改Namespace白名单"),
    WHITE_NAMESPACE_DEL(29, "删除Namespace白名单"),

    // 命名空间权益
    QUOTA_CONFIG_EDIT(30, "修改全局权益配置"),
    QUOTA_UPDATE(31, "修改命名空间权益"),
    ORG_DELETTE(32, "组织删除"),

    //代码库相关
    REPO_DEL(33, "代码库删除"),
    ORG_MEMBER_SET_ROLE(34, "组织下成员角色修改"),
    ORG_MEMBER_REMOVE(35, "组织下成员移除"),

    // 注册白名单
    REGISTER_WHITELIST_ON(36, "注册白名单开启"),
    REGISTER_WHITELIST_OFF(37, "注册白名单关闭"),
    REGISTER_WHITELIST_ADD(38, "注册白名单批量添加"),
    REGISTER_WHITELIST_DEL(39, "注册白名单批量删除"),

    // 系统预设标签
    SYSTEM_LABEL_ADD(40, "系统预设标签保存"),
    SYSTEM_LABEL_UPDATE(46, "系统预设标签更新"),
    SYSTEM_LABEL_DEL(41, "系统预设标签删除"),

    REPOSITY_LABEL_ADD(47, "项目预设标签保存"),
    REPOSITY_LABEL_UPDATE(48, "项目预设标签更新"),
    REPOSITY_LABEL_DEL(49, "项目预设标签删除"),

    USER_MFA_DISABLE(42, "用户mfa禁用"),

    //看板模块
    KANBAN_SELECT(42,"看板模块查询"),
    KANBAN_ADD(43,"看板模块新增"),
    KANBAN_DEL(44,"看板模块删除"),
    KANBAN_UPDATE(45,"看板模块更新"),

    //网关管理
    GATEWAY_ADD(46,"网关-路由新增"),
    GATEWAY_EDIT(47,"网关-路由编辑"),
    GATEWAY_DEL(48,"网关-路由删除"),

    //通知中心管理
    NOTIFY_BUSINESS_ADD(49,"通知中心-业务新增"),
    NOTIFY_BUSINESS_EDIT(50,"通知中心-业务编辑"),
    NOTIFY_BUSINESS_DEL(51,"通知中心-业务删除"),
    NOTIFY_TEMPLATE_ADD(52,"通知中心-通知模板新增"),
    NOTIFY_TEMPLATE_EDIT(53,"通知中心-通知模板编辑"),
    NOTIFY_TEMPLATE_DEL(54,"通知中心-通知模板删除"),
    NOTIFY_REMIND_DEL(55,"通知中心-系统通知删除"),
    NOTIFY_PRIVATE_DEL(56,"通知中心-用户私信删除"),
    NOTIFY_ANNOUNCE_ADD(57,"通知中心-公告新增"),
    NOTIFY_ANNOUNCE_EDIT(58,"通知中心-公告编辑"),
    NOTIFY_ANNOUNCE_DEL(59,"通知中心-公告删除"),
    ORG_MEMBER_ADD(60, "组织成员添加"),

    OTHER(-1, "其它"),
    ;

    @EnumValue
    private Integer value;
    @JsonValue
    private String desc;

    @JsonCreator
    ActionTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static ActionTypeEnum get(Integer value) {
        for (ActionTypeEnum action : ActionTypeEnum.values()) {
            if (action.value.equals(value)) {
                return action;
            }
        }
        throw new IllegalArgumentException("value param error");
    }


}
